package com.justerdu.mvpclient;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.justerdu.mvpclient.login.view.UserActivity;
import com.justerdu.mvpclient.user.view.CrudActivity;

/**
 * @Author JusterDu 2016/11/19.
 * @Func
 */
public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private Button btnLogin;
    private Button btnCrud;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        btnLogin = (Button) this.findViewById(R.id.btn_login);
        btnCrud = (Button) this.findViewById(R.id.btn_crud);

        // 为Button设置监听
        btnLogin.setOnClickListener(this);
        btnCrud.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.btn_login:
                Intent intentLogin = new Intent(MainActivity.this, UserActivity.class);
                startActivity(intentLogin);
                break;
            case R.id.btn_crud:
                Intent intentCrud = new Intent(MainActivity.this, CrudActivity.class);
                startActivity(intentCrud);
                break;
        }
    }
}
